package com.example.helloworld;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;

public class Layout extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_layout);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.layout, menu);
		return true;
	}

		private void callActivity(Class<?> cls, int layoutID, View view) {
	        Intent intent = new Intent(Layout.this, cls);
	        intent.putExtra("layout.id", layoutID);
	        
	        startActivity(intent);
		}

		private void callActivity(Class<?> cls, View view) {
	        Intent intent = new Intent(Layout.this, cls);
	        
	        startActivity(intent);
		}
		
	public void showLinearLayout(View view) {
		callActivity(OpenLayout.class, R.layout.activity_linear_layout, view);
	}
	
	public void showRelativeLayout(View view) {
		callActivity(OpenLayout.class, R.layout.activity_relative_layout, view);
	}

	public void showTableLayout(View view) {
		callActivity(OpenLayout.class, R.layout.activity_table_layout, view);
	}
	
	public void showScrollView(View view) {
		callActivity(SimpleScrollView.class, view);
	}
	
	public void showDynamicLayout(View view) {
		callActivity(DynamicLayout.class, view);
	}
}
